package com.njtoyo.taxi.admin.rest.controller.open;

import com.njtoyo.taxi.admin.library.qiniu.QiNiuService;
import com.taxi.entity.common.RestResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/open/upload")
@Api(tags = "上传")
public class UploadController {

    @Autowired
    private QiNiuService qiNiuService;

    @GetMapping("/get_driver_notify_message_token")
    @ApiOperation(value = "获取司机通知消息上传的token", notes = "无需权限")
    public RestResult getDriverNotifyMessageToken() {
        return RestResult.success(qiNiuService.uploadToken("driverNotifyMessage"));
    }

    @GetMapping("/get_activity_token")
    @ApiOperation(value = "获取活动上传的token", notes = "无需权限")
    public RestResult getActivityToken() {
        return RestResult.success(qiNiuService.uploadToken("activity"));
    }

    @GetMapping("/advertisement-token")
    @ApiOperation(value = "获取广告上传的token", notes = "无需权限")
    public RestResult advertisementToken() {
        return RestResult.success(qiNiuService.uploadToken("advertisement"));
    }

    @GetMapping("/local-service-token")
    @ApiOperation(value = "获取本地生活上传的token", notes = "无需权限")
    public RestResult localServiceToken() {
        return RestResult.success(qiNiuService.uploadToken("localService"));
    }
}
